#include <iostream>
using namespace std;

int main(void)
{
    int a;
    while(cin>>hex>>a)
    {
        cout<<a<<endl;
    }
}